package config_order.config;

import config_order.bean.Bean1;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * 描述：
 *
 * @author 🧑 ‍wanwei
 * @since 2022-10-14 11:57
 */
@Component
public class BeanFactoryAwareDemo implements BeanFactoryAware {


	@Override
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		System.out.println("BeanFactoryAwareDemo");
		DefaultListableBeanFactory defaultListableBeanFactory = (DefaultListableBeanFactory) beanFactory;
		defaultListableBeanFactory.registerSingleton("beanFactoryAwareAdd",new Bean1("beanFactoryAwareAdd","beanFactoryAwareAdd","beanFactoryAwareAdd"));
	}
}
